
'''
pip install dnspython
'''

import dns.resolver

hosts = ["oreilly.com", "yahoo.com", "google.com", "microsoft.com", "cnn.com"]


def query(host_list=hosts):
    collection = {}
    for host in host_list:
        collection[host] = []
        ips = dns.resolver.query(host, "A")
        for ip in ips:
            collection[host].append(str(ip))
    return collection


if __name__ == "__main__":
    records = query()
    for domain in records.keys():
        print('{}:'.format(domain))
        for ip in records[domain]:
            print('  {}'.format(ip))
